package com.isyscore.service.admin.impl;

import com.isyscore.dto.PageInfoDto;
import com.isyscore.dto.sys.ListUserForm;
import com.isyscore.dto.sys.UserDto;
import com.isyscore.entity.admin.SysUser;
import com.isyscore.mapper.admin.SysUserMapper;
import com.isyscore.service.admin.SysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author LGL
 * @since 2024年10月25日
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {

    @Override
    public PageInfoDto<UserDto> listUsers(ListUserForm form) {
        return  new PageInfoDto<UserDto>(
                form.getPageNum(),
                form.getPageSize(),
                baseMapper.listUsersTotal(form),
                (baseMapper.listUsersTotal(form) + form.getPageSize() - 1) / form.getPageSize(),
                baseMapper.listUsers(form));
    }
}
